#include <bits/stdc++.h>

using std::cin;
using std::cout;
using std::vector;

const int MODULO = 268435459;

int main() {
    int n, m;
    cin >> n >> m;
    vector <vector <int> > grid(n, vector <int>(m, 0));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> grid[i][j];
        }
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (i + j == 0) {
                continue;
            }
            grid[i][j] *= (i > 0 ? grid[i - 1][j] : 0) + (j > 0 ? grid[i][j - 1] : 0);
            grid[i][j] %= MODULO;
        }
    }
    cout << grid[n - 1][m - 1];
}
